package com.example.demo.service;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.util.Arrays;

/**
 * @author linjingze
 * @date 2023/12/19 12:55 PM
 */
@Data
@NoArgsConstructor
public class AreaPrice implements Comparable<AreaPrice> {

    private Integer min;

    private Integer max;

    private BigDecimal amount;

    public AreaPrice(Integer min, Integer max, BigDecimal amount) {
        this.min = min;
        this.max = max;
        this.amount = amount;
    }



    @Override
    public int compareTo(AreaPrice o) {
        return Integer.compare(min, o.min);
    }

    public static void main(String[] args) {
        AreaPrice areaPrice = new AreaPrice();
        areaPrice.setMin(1);
        areaPrice.setMax(10);

        AreaPrice areaPrice2 = new AreaPrice();
        areaPrice2.setMin(2);
        areaPrice2.setMax(10);
        Arrays.asList(areaPrice,areaPrice2).stream().sorted().forEach(System.out::println);
    }
}
